package com.hh.core.beetl;

import java.util.HashMap;
import java.util.Map;

import org.beetl.ext.spring.BeetlGroupUtilConfiguration;

import com.hh.core.property.BaseProperty;
import com.hh.core.shiro.util.ShiroUtil;

/**
 * 
* @ClassName: BeetlConfiguration  
* @Description: TODO(Beetl 注册自己的函数，标签等)  
* @author hxn
* @date 2018年1月18日 下午3:44:11  
*
 */
public class BeetlConfiguration extends BeetlGroupUtilConfiguration{

	private BaseProperty baseProperty;
	
	public BeetlConfiguration(BaseProperty baseProperty){
		this.baseProperty = baseProperty;
	}
	
	@Override
    public void initOther() {
		
		groupTemplate.registerFunctionPackage("shiro", new ShiroUtil());
//		groupTemplate.registerFunctionPackage(packageName, cls);
		
		Map<String, Object> sharedVars = new HashMap<String,Object>();
		sharedVars.put("jsPath", baseProperty.getJsPath());
		sharedVars.put("pluginPath", baseProperty.getPluginPath());
		sharedVars.put("cssPath", baseProperty.getCssPath());
		sharedVars.put("adminPath", baseProperty.getAdminPath());
		sharedVars.put("imagePath", baseProperty.getImagePath());
		sharedVars.put("captchaOpen", baseProperty.getCaptchaOpen());
		groupTemplate.setSharedVars(sharedVars);
	}
}
